<!DOCTYPE html>
<html class="pixel-ratio-1"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>茵曼商城</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="css/sm.min.css">
    <link rel="stylesheet" href="css/sm-extend.min.css">
    <link rel="stylesheet" href="css/inman.css">
    <script src="https://hm.baidu.com/hm.js?5ee51ef74fa865950bb9a2757fdb33ad"></script><script type="text/javascript" src="js/zepto.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/sm.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/sm-extend.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/functions.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/TouchSlide.1.1.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/jweixin-1.0.0.js"></script>
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?5ee51ef74fa865950bb9a2757fdb33ad";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
    <style type="text/css">.full-html,.full-body{width: 100% !important;height: 100% !important;margin: 0 !important;overflow: hidden !important;}.full-body *{display: none !important;}.full-iframe {display: block !important;}.full-inpage {width: 100% !important;height: 100% !important;margin: 0 !important;overflow: hidden !important;background: rgb(243, 243, 247) !important;}.full-inpage > *:not(.ntalk-mobile-inpage-background) {display: none !important;}</style><script type="text/javascript" async="async" charset="utf-8" src="http://sh-trail.ntalker.com/trail/trail/userinfo.php?action=getregion&amp;siteid=kf_9154&amp;userid=kf_9154_ISME9754_1122715&amp;callback=trail_getregion_072C11DF"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/zh_cn.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011034" data-requiremodule="lang"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/chat.in.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011034" data-requiremodule="chatManage"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/mqtt31.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011034" data-requiremodule="MQTT"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/mqtt.chat.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011034" data-requiremodule="Connection"></script></head>
<body><div class="page-group favourites-page">
    <div class="page page-current" id="page-1510724226935">
        <!--标题栏-->
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left" href="javascript:history.back(-1);"></a>

            <h1 class="title">我的收藏</h1>
        </header>
        <input type="hidden" id="pagenum" value="1">
        <!--内容区-->
        <div class="content infinite-scroll infinite-scroll-bottom native-scroll" data-distance="100">
            <div class="box1">
                <ul>
                    <li>
                        <div class="w-30">
                            <a href="http://m.inman.com.cn/index.php/Goods/goodsdetail?goods_bn=1874132427" style="background-image: url(http://img.inman.com.cn/uploads/image/20171012/1507788670684961.jpg);"></a>
                        </div>
                        <div class="w-70">
                            <a href="http://m.inman.com.cn/index.php/Goods/goodsdetail?goods_bn=1874132427"><p class="goods-name">[商品]茵曼2017冬新款文艺黑白条纹半高...</p></a>

                            <p class="goods-price"><span>￥</span>199.000</p>

                            <p class="goods-delete"><a href="#" class="delete-favourite" data-id="36957">
                                <img src="/public/images/favourites_2.png"></a></p>
                        </div>
                        <div class="cb"></div>
                    </li>
                </ul>
            </div>
            <div class="tip">
                <p>已加载完所有数据</p>
            </div>
        </div>
    </div>
    <script>
        var loading = false;
        $("div.infinite-scroll-preloader").hide();
        //下拉加载
        $(document).on('infinite', '.infinite-scroll-bottom', function () {
            var pageNum = $("#pagenum").val();
            var uri = "http://m.inman.com.cn/index.php/User/loadFavorite";
            $.ajax({
                cache: true,
                type: "POST",
                url: uri,
                data: {pageNum: pageNum},
                async: false,
                success: function (json) {
                    json = eval('(' + json + ')');
                    if (json.errcode != '1') {
                        $.toast(json.errmsg);
                        return false;
                    }
                    //如果m
                    if (json.data == '') {
                        $("div.infinite-scroll-preloader").hide();
                        // 加载完毕，则注销无限加载事件，以防不必要的加载
                        $.detachInfiniteScroll($('.infinite-scroll'));
                        // 删除加载提示符
                        $('.infinite-scroll-preloader').remove();
                        $('.tip p').show();
                        return false;
                    }
                    $("#pagenum").val(pageNum * 1 + 1);
                    var html = '';
                    var favdata = json.data;
                    for (var i = 0; i < favdata.length; i++) {
                        if(favdata[i].type==5){
                            console.log(favdata);
                            html += '<li><div class="w-30"><a href="/Goods/goodsdetail?goods_bn='+favdata[i].goods_bn+'" style="background-image: url('+favdata[i].img_url+');"></a></div><div class="w-70"><p class="goods-name">' + favdata[i].title + '</p> <p class="goods-price"><span>￥</span>' + favdata[i].price + '</p><p class="goods-delete"><a href="#" class="delete-favourite" data-id="' + favdata[i].id + '"><img src="/public/images/favourites_2.png"  /></a></p> </div> <div class="cb"></div> </li>';
                        }else{
                            var type = '';
                            switch (favdata[i].type){
                                case 1:
                                    type = '活动';
                                    break;
                                case 2:
                                    type = '曼时尚';
                                    break;
                                case 3:
                                    type = '曼活';
                                    break;
                                case 4:
                                    type = '美搭';
                                    break;
                            }
                            html += '<li><div class="w-30"><a href="/Yinyuehui/articleDetails?article_id='+favdata[i].target_id+'" style="background-image: url('+favdata[i].img_url+');"></a></div><div class="w-70"><p class="goods-name">['+type+']' + favdata[i].title + '</p> <p class="article-des">' + favdata[i].description + '</p><p class="goods-delete"><a href="#" class="delete-favourite" data-id="' + favdata[i].id + '"><img src="/public/images/favourites_2.png"  /></a></p> </div> <div class="cb"></div> </li>';
                        }

                    }
                    $('.box1 ul').append(html);
                    //绑定删除事件
                    deleteFavourite();
                }
            });
        });

        function deleteFavourite() {
            //清除之前的绑定事件
            $('.delete-favourite').unbind("click");

            //绑定点击事件
            $('.delete-favourite').click(function () {
                var id = $(this).attr('data-id');
                var buttons1 = [
                    {
                        text: '确认删除所选收藏?',
                        label: true
                    },
                    {
                        text: '确定',
                        onClick: function () {
                            var uri = "http://m.inman.com.cn/index.php/User/deleteFavorite";
                            $.showIndicator();
                            $.ajax({
                                cache: true,
                                type: "POST",
                                url: uri,
                                data: {id: id},
                                async: false,
                                success: function (json) {
                                    $.hideIndicator();
                                    json = eval('(' + json + ')');
                                    if (json.errcode != '1') {
                                        $.toast(json.errmsg);
                                        return false;
                                    }
                                    $.toast(json.errmsg);
                                    if (json.errcode && json.url !== '') {
                                        setTimeout(function () {
                                            window.location.href = json.url;
                                        }, 1000);
                                    } else {
                                        return false;
                                    }

                                }
                            });
                        }
                    }
                ];
                var buttons2 = [
                    {
                        text: '取消',
                        bg: 'danger'
                    }
                ];
                var groups = [buttons1, buttons2];
                $.actions(groups);
            });
        }

        $(function(){
            deleteFavourite();
        });

        $.init();
    </script>

</div><div id="nTalk_post_hiddenElement" style="left: -10px; top: -10px; visibility: hidden; display: none; width: 1px; height: 1px;"></div>



</body></html>